package cn.jbolt.ec.log;

import cn.jbolt._admin.permission.CheckPermission;
import cn.jbolt._admin.permission.PermissionKey;
import cn.jbolt.base.JBoltBaseController;
import cn.jbolt.common.bean.OptionBean;
import cn.jbolt.common.model.BecOpLog;
import com.jfinal.aop.Inject;
import com.jfinal.plugin.activerecord.Page;

import java.util.ArrayList;
import java.util.List;

@CheckPermission(PermissionKey.LOG_ADMIN)
public class OpLogAuthController extends JBoltBaseController {
    @Inject
    OpLogService opLogService;
    @CheckPermission(PermissionKey.LOG_MEMBER_INDEX)
    public void index(){
        Page<BecOpLog> page=opLogService.paginate_Log(getPageNumber(),getPageSize(),getKeywords(),getInt("onTime"));
        keepPara();
        set("pageData",page);
        render("index.html");
    }
    @CheckPermission(PermissionKey.LOG_MEMBER_INDEX)
    public void on_time(){
        List<OptionBean> optionBeans = new ArrayList<OptionBean>();
        optionBeans.add(new OptionBean("近三天记录",3));
        optionBeans.add(new OptionBean("近一周记录",7));
        optionBeans.add(new OptionBean("近十天记录",10));
        optionBeans.add(new OptionBean("近一个月记录",31));
        optionBeans.add(new OptionBean("近三个月记录",93));
        renderJsonData(optionBeans);
    }
}
